open and export: resolve a short unique session-ID prefix#315
Merged
Conversation
Accept a unique prefix of a session ID wherever open and export take a full <id>, mirroring git short-SHA behavior. An exact full-ID match wins outright; a unique prefix expands to its full ID; an ambiguous prefix is rejected with the list of matching sessions. Resolution lives in a new Store.ResolveIDPrefix and is wired into the default DB loaders only, so the command test seams are unaffected. LIKE wildcards in the prefix are escaped and matched literally. The usage banner documents the new behavior. Closes #314 Co-authored-by: Copilot App <[email protected]>
# Conflicts: # cmd/dispatch/main.go # cmd/dispatch/main_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves short session-ID prefixes for
openandexport, like git short SHAs.What changed
Store.ResolveIDPrefix(ctx, prefix): exact full-ID match wins; a unique prefix expands to its full ID; an ambiguous prefix returns*AmbiguousIDPrefixErrorlisting candidates; no match returnssql.ErrNoRows. LIKE wildcards are escaped and matched literally.defaultOpenGetSession,defaultExportGetDetail) only, so command test seams stay unaffected.<id>accepts a unique prefix.Tests
TestPrintUsage_Outputupdated to drain the pipe concurrently (the banner grew past the Windows pipe buffer).Verification
go build ./...,go vet ./...,go test ./... -count=1all pass.golangci-lint runreports 0 issues.mage deadcodereports OK.Closes #314